﻿<Page xmlns:dxg="clr-namespace:DevExpress.Xpf.Grid;assembly=DevExpress.Xpf.Grid.v12.1"  x:Class="CalligraphyEditor.DevPAuthors"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" 
      mc:Ignorable="d" 
       xmlns:vm="clr-namespace:CalligraphyEditor.ViewModel"
      d:DesignHeight="300" d:DesignWidth="300"
	Title="书法家">
<Page.Resources>
        <vm:VMAuthors x:Key="Vm_authos"/>
 </Page.Resources>
    <Grid>
        <dxg:GridControl Grid.Row="1"  Name="Gcl_Authors" DataContext="{Binding Source={StaticResource Vm_authos}, Path=Cvs_authors}" ItemsSource="{Binding}" >
            
            <dxg:GridControl.Columns>                
                <dxg:GridColumn FieldName="Name" Header="名称" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings  TextWrapping="Wrap" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="AnotherName" Header="别名" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings  TextWrapping="Wrap" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="SubDescription" Header="简介" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings  TextWrapping="Wrap" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                
                <dxg:GridColumn FieldName="Location" Header="出生地" >
                    
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings  TextWrapping="Wrap" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="YearOfBirth" Header="出生日期" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings  DisplayFormat="yyyy" Mask="yyyy" MaskType="DateTime" MaskUseAsDisplayFormat="True"  />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="YearOfDeath" Header="逝世日期" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings  DisplayFormat="yyyy" Mask="yyyy" MaskType="DateTime" MaskUseAsDisplayFormat="True"  />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="T_Dynast.Name" Header="朝代" />
                <dxg:GridColumn FieldName="Description" Header="详细介绍" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings  TextWrapping="Wrap" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn   Header="图片" >
                    <dxg:GridColumn.CellTemplate>
                        <DataTemplate>
                            <Button  Click ="Button_Click_AddPhoto" MinHeight="40" MinWidth="40" >
                               <Image Margin="0,0,0,0"  Stretch="Uniform"   Source="{Binding Path=Data.AuthorPhoto, Mode=OneWay}"  />
                            </Button>
                        </DataTemplate>
                    </dxg:GridColumn.CellTemplate>
                </dxg:GridColumn>
                <dxg:GridColumn   >
                    <dxg:GridColumn.CellTemplate>
                        <DataTemplate>
                            <Button  Click="Button_Click_Browse"  MinHeight="40" MinWidth="40" Content="查看" />
                        </DataTemplate>
                    </dxg:GridColumn.CellTemplate>
                </dxg:GridColumn>
            </dxg:GridControl.Columns>
            <dxg:GridControl.View>
                <dxg:CardView AllowEditing="True" ShowGroupedColumns="True"  NavigationStyle="Cell" FixedSize="300" MinFixedSize="150" Name="view" CardHeaderDisplayMemberBinding="{Binding Path=Data.Name, RelativeSource={RelativeSource Self}}" CellValueChanged="view_CellValueChanged" />
            </dxg:GridControl.View>
        </dxg:GridControl>
    </Grid>
</Page>
